﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace Vision.VisionWorkshop.Common
{
	internal class OrderByConverter : IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			if (value is System.Collections.IEnumerable)
			{
				return System.Linq.Dynamic.DynamicQueryable.OrderBy((value as System.Collections.IEnumerable).AsQueryable(), parameter.ToString(), null);
			}

			return value;
		}

		public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			return value;
		}
	}
}
